unit SceneManager;

interface

uses Scene;

type
  TSceneManager = class(TScene)
  private
    FScene: TScene;
    procedure SetScene(const Value: TScene);
  public
    procedure Clear;
    procedure Render(); override;
    procedure Update(); override;
    property Scene: TScene read FScene write SetScene;
  end;

implementation

uses Engine;

{ TSceneManager }

procedure TSceneManager.Clear;
begin
  Scene := nil
end;

procedure TSceneManager.Render;
begin
  if (Scene <> nil) then Scene.Render;
end;

procedure TSceneManager.SetScene(const Value: TScene);
begin
  FScene := Value;
  pEngineCore.WriteToLog(PAnsiChar(AnsiString('[HoD] Scene Manager set current scene ' + Value.ClassName + '.')));
end;

procedure TSceneManager.Update;
begin
  if (Scene <> nil) then Scene.Update;
end;

end.
